package com.neusoft.controller;

import com.neusoft.domain.PageResult;
import com.neusoft.domain.Result;
import com.neusoft.domain.Shop;
import com.neusoft.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/shop")
public class ShopController {
    @Autowired
    private ShopService shopService;
    @GetMapping("pageSelectShop")
    public Result pageSelectShop(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam("shop_name") String shop_name, @RequestParam("shop_address") String shop_address){
       PageResult<Shop>result= shopService.pageSelectShop(pageNum,pageSize,shop_name,shop_address);
        return Result.success(result);
    }
    @PutMapping("/recommendShop")
    public Result recommendShop(@RequestBody Shop shop){
        Integer shop_id = shop.getShop_id();
        Integer recommend = shop.getRecommend();
        shopService.recommendShop(shop_id,recommend);
        return Result.success();
    }
}
